<script setup lang="ts">
import {refreshRouter} from '@/router/index'
import { useRoute, useRouter } from 'vue-router';

const router = useRouter();
const route = useRoute();

const login = async ()=>{
    try {
        let redirectUrl:any = '/';
        if(route.query.redirect && route.query.redirect !=='/login'){
            redirectUrl = route.query.redirect
        }
        await refreshRouter();
        router.push(redirectUrl)
    } catch (error) {
        console.log(error)
    }
}
</script>
<template>
    <div>登录界面</div>
    <button @click="login()">登录</button>
</template>